<?php
/**
 * jiafeimao
 */
namespace app\common\model;

use think\Model;
use traits\model\SoftDelete;

/**
 * 分类模型
 */
class Coupon extends Model
{
	protected $table="dsc_coupon";
    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';

    public static function addNum($member_id,$coupon,$coupon_condition,$is_use=0,$get_way=1,$expiration_time=0){
		$data=[
			'member_id'=>$member_id,
			'coupon'=>$coupon,
			'coupon_condition'=>$coupon_condition,
			'is_use'=>$is_use,
			'get_way'=>$get_way,
			'expiration_time'=>$expiration_time,
		];

		$res=self::create($data,true);
		if($res !== false){
			return $res->id;
		}else{
			return false;
		}
	}

}
